import 'package:myapp/entities/entities.dart';
import 'models.dart';

class Comment {
  String commentId;
  DateTime createdAt;
  DateTime updatedAt;
  String body;
  MyUser author;

  Comment(
      {
    required this.commentId,
    required this.createdAt,
    required this.updatedAt,
    required this.body,
    required this.author,
      });
  CommentEntity toEntity() {
    return CommentEntity(
        commentId: commentId,
        body: body,
        createdAt: createdAt,
        updatedAt: updatedAt,
        author: author);
  }

  static Comment fromEntity(CommentEntity entity) {
    return Comment(
        commentId: entity.commentId,
        body: entity.body,
        createdAt: entity.createdAt,
        updatedAt: entity.updatedAt,
        author: entity.author);
  }
}